package vendingMachine;

import static org.junit.Assert.*;
  
import org.junit.Before;
import org.junit.Test;

public class VendingMachineItemTest {

	VendingMachineItem vmi = null;
	
	@Before
	public void setUp() throws Exception {
		vmi= new VendingMachineItem("Soda", 1.25);
	}

 	@Test
	public final void testVendingMachineItemNullName() {
		VendingMachineItem vmi = new VendingMachineItem(null, 1.25);
		assertEquals(null, vmi.getName());
		assertEquals(1.25, vmi.getPrice(), 0);
	}

	@Test(expected = VendingMachineException.class)
	public final void testVendingMachineItemNegativePrice() {
		@SuppressWarnings("unused")
		VendingMachineItem vmi = new VendingMachineItem("Soda", -1.25);
		
	}

	@Test
	public final void testVendingMachineItem() {
		assertEquals("Soda", vmi.getName());
		assertEquals(1.25, vmi.getPrice(), 0);

	}

	@Test
	public final void testGetName() {
		assertEquals("Soda", vmi.getName());
	}

	@Test
	public final void testGetPrice() {
		assertEquals(1.25, vmi.getPrice(), 0);
	}

}
